package com.example.zhangwei.model;

import java.util.HashMap;

import android.os.Parcel;
import android.os.Parcelable;

public class DataParcelable implements Parcelable 
{
	public int id;
	
	public String name;
	
	public HashMap<String, String> mapData ;

	public DataParcelable(int id, String name, HashMap<String, String> mapData) {
		super();
		this.id = id;
		this.name = name;
		this.mapData = mapData;
	}
	
	public DataParcelable() 
	{
		
	}
	
	@SuppressWarnings("unchecked")
	public DataParcelable(Parcel in) {
		name = in.readString();  
		id = in.readInt();  
		mapData = in.readHashMap(null);
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		// TODO Auto-generated method stub
		dest.writeString(name);  
        dest.writeInt(id);
        dest.writeMap(mapData);  
	}
	
	public static final Parcelable.Creator<DataParcelable> CREATOR = new Parcelable.Creator<DataParcelable>() {  
		public DataParcelable createFromParcel(Parcel in) {  
			return new DataParcelable(in);  
		}  

		public DataParcelable[] newArray(int size) {  
			return new DataParcelable[size];  
		}  
	};  

}
